Skip to content

Functions for running "access path suggestions" queries#3294

Merged
shati-patel merged 2 commits intomainfrom
shati-patel/run-suggestions-query
Jan 31, 2024
Merged

Functions for running "access path suggestions" queries#3294
shati-patel merged 2 commits intomainfrom
shati-patel/run-suggestions-query

Conversation

@shati-patel
Copy link
Copy Markdown
Contributor

This PR adds functions for running "suggestion queries" (i.e. CodeQL queries that populate the autocomplete suggestions in the model editor). These queries currently live on a branch from @koesie10's hackathon branch, so it's possible that the exact names and tags will change in future.

See internal issue for more details and context! ✨

Checklist

N/A - only used in tests for now

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@shati-patel shati-patel requested a review from a team as a code owner January 30, 2024 16:34
import { QueryOutputDir } from "../../../../src/local-queries/query-output-dir";
import { runSuggestionsQuery } from "../../../../src/model-editor/suggestion-queries";

describe("runSuggestionsQuery", () => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mainly added this test so that the new function wouldn't get flagged as deadcode 🙈 It's heavily inspired by the runModelEditorQueries test.

const outputDir = new QueryOutputDir(join((await file()).path, "1"));

const options = {
parseResults: jest.fn().mockResolvedValue([]),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test that this function is called twice with mock results from bqrsDecodeAll and that the function returns the first and second results inside an object with input and output keys? I think that would add some value to ensure that the flow is correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, thanks! I've added some mock data to make the test a bit more useful 🙌🏽

Copy link
Copy Markdown
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@shati-patel shati-patel merged commit 9cd6daf into main Jan 31, 2024
@shati-patel shati-patel deleted the shati-patel/run-suggestions-query branch January 31, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants